<div id="containercenter">
	<?php 
		require('navigation.php');
		require('navHistory.php'); 
	?>
	<div id="containerleft">
		<h2>Checkout</h2> 
		<?php if(isset($_POST['idOffer'])){?>
			<?php $id_offerta = $_POST['idOffer'];?>
			<table>
				<tr>
					<td>
					
						<table>
							<tr>
								<td colspan="1" width="auto">
									<h3>L'ordinazione &egrave; stata verificata con successo</h3>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td style="color: #AAA;">
						<b><?php echo $_POST['nameOffer_' . $id_offerta]; ?></b>
					</td>
				</tr>
				<tr>
					<td>
						Numero crediti: <?php echo $_POST['creditsOffer_' . $id_offerta]; ?>
					</td>
				</tr>
				<tr>
					<td>
						Importo Pagamento: <?php echo $_POST['priceOffer_' . $id_offerta] . ' CHF'; ?>
					</td>
				</tr>
				
				<tr>
					<td>
						Totale: <b><?php echo $_POST['priceOffer_' . $id_offerta] . ' CHF'; ?></b>
					</td>
				</tr>
				<tr>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="3" style="border-bottom: 1px dotted #999999;">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td>
						<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="POST">
							<input type="hidden" name="cmd" value="_cart">
							<input type="hidden" name="upload" value="1">
							<input type="hidden" name="business" value="poncin_1263826407_biz@gmail.com">
							<input type="hidden" name="currency_code" value="CHF">
							
							<?php 
								echo '<input type="hidden" name="item_name_1" value="' . $_POST['nameOffer_' . $id_offerta] . '">';
								echo '<input type="hidden" name="quantity_1" value="' . $_POST['creditsOffer_' . $id_offerta] . '">';
								echo '<input type="hidden" name="amount_1" value="' . ($_POST['priceOffer_' . $id_offerta] / $_POST['creditsOffer_' . $id_offerta]) . '">';
							?>
							<input type="image" src="https://www.sandbox.paypal.com/it_IT/IT/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="Paypal - Il sistema di pagamento online piu facile e sicuro!">
							<img alt="" border="0" src="https://www.sandbox.paypal.com/it_IT/IT/i/src/pixel.gif" width="1" height="1">
						</form>
	
					</td>
				</tr>
			</table>
		<?php }else {?>
		<table>
			<tr>
				<td colspan="1" width="350">
					<h3 width="200" >L'ordinazione &egrave; stata verificata con successo!</h3>
				</td>
			</tr>
			<tr>
				<td>
					Numero crediti: <?php echo $_POST['importoCrediti']; ?>
				</td>
			</tr>
			<tr>
				<td>
					Importo Pagamento: <?php echo $_POST['importoPagamento'] . ' CHF'; ?>
				</td>
			</tr>
			<tr>
				<td>
					Importo Tassa: <?php echo $_POST['importoTassa']; ?>
				</td>
			</tr>
			<tr>
				<td>
					Totale: <b><?php echo $_POST['importoTotalePagamento']; ?></b>
				</td>
			</tr>
			<tr>
				<td>
					&nbsp;
				</td>
			</tr>
			<tr>
				<td colspan="3" style="border-bottom: 1px dotted #999999;">
					&nbsp;
				</td>
			</tr>
			<tr>
				<td>
					&nbsp;
				</td>
			</tr>
			<tr>
				<td>
					<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="POST">
						<input type="hidden" name="cmd" value="_cart">
						<input type="hidden" name="upload" value="1">
						<input type="hidden" name="business" value="poncin_1263826407_biz@gmail.com">
						<input type="hidden" name="currency_code" value="CHF">
						
						<?php 
							echo '<input type="hidden" name="item_name_1" value="' . $_POST['nomeAcquisto'] . '">';
							echo '<input type="hidden" name="quantity_1" value="' . $_POST['importoCrediti'] . '">';
							echo '<input type="hidden" name="amount_1" value="1">';
							echo '<input type="hidden" name="tax_1" value="'. (1/100)*2 . '">';
						?>
						<input type="image" src="https://www.sandbox.paypal.com/it_IT/IT/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="Paypal - Il sistema di pagamento online piu facile e sicuro!">
						<img alt="" border="0" src="https://www.sandbox.paypal.com/it_IT/IT/i/src/pixel.gif" width="1" height="1">
					</form>

				</td>
			</tr>
		</table>
		<?php }?>
	</div>
	
</div>